home *** CD-ROM | disk | FTP | other *** search
- Path: prairienet.org!wemccaug
- From: wemccaug@prairienet.org (Wendy E. McCaughrin)
- Newsgroups: comp.lang.c
- Subject: Re: How to pass function as arg?
- Date: 21 Apr 1996 03:37:11 GMT
- Organization: University of Illinois at Urbana
- Message-ID: <4lcah7$fhj@vixen.cso.uiuc.edu>
- References: <317937f7.325108@news.csus.edu>
- Reply-To: wemccaug@prairienet.org (Wendy E. McCaughrin)
- NNTP-Posting-Host: firefly.prairienet.org
-
-
- In a previous article, wleong@sfsu.edu (Jerry Leong) says:
-
- >Please don't flame me for asking this question as I have read the faq,
- >the newsgroup & I still couldn't find a satisfying answer.
- >
- >I couldn't quite figure out how to do this. Below is the pseudo-code :
- >
- >void do_something(void)
- >{
- >}
- >
- >void call_this(void func)
- >{
- > func();
- >}
- >
- >main()
- >{
- > void (*fp)() = do_something();
- s/b: " " " " = do_something;
- > call_this(fp);
- >}
- >
- >Okay, I am quite sure that I got the main() part right. But I'm not
- >sure how
- Also should change the definition of 'call_this' to take a
- function-ptr and invoke the function indirectly through it.
-
-